﻿using System.Security.Cryptography;
using System.Text;

namespace Admin.Crypto.Utils
{
    public static class StringExtensions
    {
        public static string Md5To32Bit(this string source)
        {
            using MD5 mD = MD5.Create();
            byte[] bytes = Encoding.UTF8.GetBytes(source);
            byte[] array = mD.ComputeHash(bytes);
            string text = "";
            for (int i = 0; i < array.Length; i++)
            {
                text += array[i].ToString("x2");
            }

            return text;
        }
    }
}
